#include <cstdio>

int main( )
{
    int t, n, p, q;
    scanf("%d", &t);
    while ( t-- )
    {
        scanf("%d%d", &n, &p);
        while ( --n )
        {
            scanf("%d", &q);
            p += q - 1;
        }
        printf("%d\n", p);
    }
    return 0;
}
